﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Modellayer;

namespace Controllayer
{
    public class PersonCtr
    {
        private Dblayer.DbPerson dbPerson;

        public PersonCtr()
        { 
            dbPerson = new Dblayer.DbPerson();
        }

        public void createEmployee(int phoneNumber, string email, string name, string password, string loginId)
        {
            Person p = new Person(phoneNumber, email, password, name, loginId, "Employee");
            dbPerson.createPerson(p);
            
        }

        public void createCustomer(int phoneNumber, string email, string name, string password)
        {
            Person p = new Person(phoneNumber, email, password, name, "0", "Customer");
            dbPerson.createPerson(p);
        }

        public Person findPerson(int phoneNumber)
        {
            Person p = dbPerson.findPerson(phoneNumber);
            return p;
        }

        public void updateEmployee(Person p)
        {
            dbPerson.updateEmployee(p);
        }

        public void updateCustomer(Person p)
        {
            dbPerson.updateCustomer(p);
        }

        public List<Person> findAllPerson()
        {
            List<Person> pers = dbPerson.findAllPersons();

            return pers;

              
        }

    }
}
